import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from os.path import join,dirname
import numpy
import graph_common

name="2024-03-23-20-07-09-208404.png"
DIR = dirname(__file__)
path=join(DIR, "gray_scale_188_120", name)
img=mpimg.imread(path)

copy_img=[]
temp=[]

for i in range(0,188):
    for j in range(0,120):
        element_int =int(img[j][i]*255)
        temp.append(element_int)
    copy_img.append(temp)
    temp=[]

copy_copy_img=numpy.array(copy_img)
# print(copy_copy_img)

kernel1=graph_common.laplacian_kernel()
output1=graph_common.laplacian(copy_copy_img,kernel1)
output1=output1.T


kernel2 = graph_common.gaussian_kernel(size=3, sigma=1.0)  # 创建一个3x3的高斯核  
filtered_image2 = graph_common.gaussian_filter(copy_copy_img, kernel2)  # 应用高斯滤波
filtered_image2=filtered_image2.T

# print(output)

# print(img)
#img=[[0,255],[255,0]]

plt.subplot(2,2,1)
plt.imshow(img,cmap='gray')
plt.subplot(2,2,2)
plt.imshow(filtered_image2,cmap='gray')
plt.subplot(2,2,3)
plt.imshow(output1,cmap='gray')
plt.show()